<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title></title>

		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/common.css" rel="stylesheet" />
		<title></title>

		<style>
			a:hover,
			a:visited,
			a:link,
			a:active {}
			
			.select_parent {
				display: table;
				width: calc(100%);
				table-layout: fixed;
				height: 40px;
				background: #FFFFFF;
			}
			
			.select_child {
				display: inline-block;
				height: 40px;
				width: 50%;
				text-align: center;
				line-height: 40px;
				font-size: 15px;
				color: #29ABE2;
				border-bottom: 2px solid #29ABE2;
			}
			
			.select_child1 {
				display: inline-block;
				height: 40px;
				width: 50%;
				text-align: center;
				line-height: 40px;
				font-size: 15px;
				color: #818181;
			}
			
			.li_parent {
				width: 100%;
				height: 55px;
				background-color: #FFFFFF;
				margin-bottom: 2px;
			}
			
			html,
			body {
				background-color: #efeff4;
			}
			
			.mui-bar~.mui-content .mui-fullscreen {
				top: 44px;
				height: auto;
			}
			
			.mui-pull-top-tips {
				position: absolute;
				top: -20px;
				left: 50%;
				margin-left: -25px;
				width: 40px;
				height: 40px;
				border-radius: 100%;
				z-index: 1;
			}
			
			.mui-bar~.mui-pull-top-tips {
				top: 24px;
			}
			
			.mui-pull-top-wrapper {
				width: 42px;
				height: 42px;
				display: block;
				text-align: center;
				background-color: #efeff4;
				border: 1px solid #ddd;
				border-radius: 25px;
				background-clip: padding-box;
				box-shadow: 0 4px 10px #bbb;
				overflow: hidden;
			}
			
			.mui-pull-top-tips.mui-transitioning {
				-webkit-transition-duration: 200ms;
				transition-duration: 200ms;
			}
			
			.mui-pull-top-tips .mui-pull-loading {
				/*-webkit-backface-visibility: hidden;
				-webkit-transition-duration: 400ms;
				transition-duration: 400ms;*/
				margin: 0;
			}
			
			.mui-pull-top-wrapper .mui-icon,
			.mui-pull-top-wrapper .mui-spinner {
				margin-top: 7px;
			}
			
			.mui-pull-top-wrapper .mui-icon.mui-reverse {
				/*-webkit-transform: rotate(180deg) translateZ(0);*/
			}
			
			.mui-pull-bottom-tips {
				text-align: center;
				background-color: #efeff4;
				font-size: 15px;
				line-height: 40px;
				color: #777;
			}
			
			.mui-pull-top-canvas {
				overflow: hidden;
				background-color: #fafafa;
				border-radius: 40px;
				box-shadow: 0 4px 10px #bbb;
				width: 40px;
				height: 40px;
				margin: 0 auto;
			}
			
			.mui-pull-top-canvas canvas {
				width: 40px;
			}
			
			.mui-slider-indicator.mui-segmented-control {
				background-color: #efeff4;
			}
		</style>

	</head>

	<body>
		<header id="header" class="mui-bar mui-bar-nav" style="background: #B01D29;text-align: center;">
			<img src="img/back.png" class=" tp-back mui-icon mui-action-back mui-icon-left-nav mui-pull-left" style="height: 40px;width: 30px;"></img>
			<a class="mui-title " style="color: white;font: bold;font-size:20px ; ">余额明细</a>
		</header>

		<div class="mui-content">
			<div id="balancemain" style="background: #FFFFFF; z-index: 10; width: 100%;">
				<div style="width:100% ;height: 110px; text-align: center; ">
					<div style="padding-top: 20px;">
						<a id="username">33068***********11</a>
					</div>
					<h1 id="balance" style="padding-top: 20px;">￥ 947.00</h1>
				</div>

			</div>
			<div id="slider" class="mui-slider mui-fullscreen" style="margin-top: 110px;">
				<div id="sliderSegmentedControl" class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<a class="mui-control-item" href="#item1mobile">
						消费记录
					</a>
					<a class="mui-control-item" href="#item2mobile">
						充值记录
					</a>
				</div>
				<div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-6"></div>

				<div class="mui-slider-group">
					<div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
						<div id="scroll1" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<ul class="mui-table-view" style="background-color: #F2F2F2;">
									<li class="li_parent" v-for="record in records">
										<div style="height:30px ; float: left; width: 100%;">
											<p style="float: left; width: 75%; line-height: 30px; font-size: 18px; color: #000000;">食堂</p>
											<p style="float: left; width: 25%; text-align: center; line-height: 30px; font-size: 18px; color: #000000;">￥{{record.consumptionmoney}}</p>
										</div>
										<div style="height:20px ;float: left; width: 100%;">
											<p style="float: left; width: 75%; line-height: 20px; font-size: 14px;">{{record.consumptiondate}}</p>
											<p style="float: left; width: 25%; text-align: center; line-height: 20px; font-size: 14px;">详情</p>
										</div>
									</li>

								</ul>
							</div>
						</div>
					</div>
					<div id="item2mobile" class="mui-slider-item mui-control-content">
						<div class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<ul class="mui-table-view" style="background-color: #F2F2F2;">
									<li class="li_parent" v-for="record in records">
										<div style="height:30px ; float: left; width: 100%;">
											<p style="float: left; width: 75%; line-height: 30px; font-size: 18px; color: #000000;">食堂</p>
											<p style="float: left; width: 25%; text-align: center; line-height: 30px; font-size: 18px; color: #000000;">￥{{record.consumptionmoney}}</p>
										</div>
										<div style="height:20px ;float: left; width: 100%;">
											<p style="float: left; width: 75%; line-height: 20px; font-size: 14px;">{{record.consumptiondate}}</p>
											<p style="float: left; width: 25%; text-align: center; line-height: 20px; font-size: 14px;">详情</p>
										</div>
									</li>

								</ul>
							</div>
						</div>
					</div>

				</div>
			</div>
		</div>

	</body>

	<script src="js/mui.min.js"></script>
	<script src="js/jquery-3.2.1.min.js"></script>
	<script src="js/vue.min.js"></script>
	<script type="text/javascript" src="js/mui.pullToRefresh.js"></script>
	<script type="text/javascript" src="js/mui.pullToRefresh.material.js"></script>
	<script>
		mui.init();
		(function($) {
			//阻尼系数
			var deceleration = mui.os.ios ? 0.003 : 0.0009;
			$('.mui-scroll-wrapper').scroll({
				bounce: false,
				indicators: true, //是否显示滚动条
				deceleration: deceleration
			});
			var sindex=0;
			
			$.ready(function() {
				//循环初始化所有下拉刷新，上拉加载。
				$.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
					$(pullRefreshEl).pullToRefresh({
						down: {
							callback: function() {
								var self = this;
								setTimeout(function() {
//									var ul = self.element.querySelector('.mui-table-view');
//									ul.insertBefore(createFragment(ul, index, 10, true), ul.firstChild);
//									self.endPullDownToRefresh();
								pushdata();
								
								}, 1000);
							}
						},
						up: {
							callback: function() {
								var self = this;
								setTimeout(function() {
//									var ul = self.element.querySelector('.mui-table-view');
//									ul.appendChild(createFragment(ul, index, 5));
//									self.endPullUpToRefresh();
								}, 1000);
							}
						}
					});
				});
				var createFragment = function(ul, index, count, reverse) {
					var length = ul.querySelectorAll('li').length;
					var fragment = document.createDocumentFragment();
					var li;
					for(var i = 0; i < count; i++) {
						li = document.createElement('li');
						li.className = 'mui-table-view-cell';
						li.innerHTML = '第' + (index + 1) + '个选项卡子项-' + (length + (reverse ? (count - i) : (i + 1)));
						fragment.appendChild(li);
					}
					return fragment;
				};
			});
			var pushdata = function() {
				var data = getdata();
					console.log("刷新内容11" + JSON.stringify(data.records));
				recorddata.records = [];
				convert(data.records);
			};
//			

			function convert(records) {
				records.forEach(function(record) {
					recorddata.records.push(record);
				});
			}
			var recorddata = new Vue({
				el: '#list',
				data: {
					records: [] //列表信息流数据
				}
			});

			function getdata() {
				if(sindex == 0) {
					//模拟数据
				
					var data = {
						records: [{
								id: 1,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 3,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 4,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 2,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 5,
								consumptiontypes: 1,
								consumptionmoney: "9.0",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 6,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 7,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 8,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 9,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 10,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							},
							{
								id: 11,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18"
							}
						]
					}
				} else if(sindex == 1) {
					//模拟数据
					var data = {
						records: [{
								id: 1,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18"
							},
							{
								id: 2,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18"
							},
							{
								id: 3,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18"
							},
							{
								id: 4,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18"
							},

							{
								id: 5,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18"
							},
							{
								id: 6,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18"
							},
							{
								id: 7,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18"
							},
							{
								id: 8,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18"
							},
							{
								id: 9,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18"
							}
						]
					}
				}
				return data;
			}

			function getdata1() {
				if(sindex == 0) {
					//模拟数据
					var data = {
						records: [{
								id: 1,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18",
							},

							{
								id: 3,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18",
							},
							{
								id: 4,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18",
							},
							{
								id: 2,
								consumptiontypes: 1,
								consumptionmoney: "9.00",
								consumptiondate: "2018-3-5 15:40:18",
							}
						]
					}
				} else if(sindex == 1) {
					//模拟数据
					var data = {
						records: [{
								id: 1,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18",
							},
							{
								id: 2,
								rechargetype: 1,
								rechargemoney: "400.00",
								rechargedate: "2018-3-5 15:40:18",
							}
						]
					}
				}
				return data;
			}

		})(mui);
	</script>

</html>